from bilibiliuploader.bilibiliuploader import BilibiliUploader
from bilibiliuploader.core import VideoPart


class UpLoaderPlus(object):
    def __init__(self, username:str, passwd:str):
        self.uploader = BilibiliUploader()
        self.uploader.login(username.strip(), passwd.strip())

    def upVideo(self, filepaths, title, tid, tag='', desc='', source='', cover_path='', dynamic=''):
        parts = []
        for i,p in enumerate(filepaths):
            parts.append(VideoPart(
                path=p,
                title=f"Part {i+1}:p{i+1}",
                desc=""
            ))
        self.uploader.upload(parts,2,title,tid,tag,desc,source,cover_path,dynamic,thread_pool_workers=5)

